#pragma once

#include "global.h"

class Piece
{
private:
	int m_x, m_y;
	int m_next_x, m_next_y;
	char m_icon;
	int m_color;
	int m_owner;
public:
	Piece()
	{
		m_x = 0;
		m_y = 0;
		m_next_x = 0;
		m_next_y = 0;
		m_icon = 1;
		m_color = 12;
		m_owner = 2;
	}
	void addMotion(int dx, int dy){m_x += dx; m_y += dy;}
	void addNextMove(int dx, int dy){m_next_x += dx; m_next_y += dy;}
	int getX(){return m_x;}
	int getY(){return m_y;}
	void setX(int x){m_x = x;}
	void setY(int y){m_y = y;}
	char getIcon(){return m_icon;}
	void setIcon(char i){m_icon = i;}
	int getColor(){return m_color;}
	void setColor(int c){m_color = c;}
	int getOwner(){return m_owner;}
	void setOwner(int o){m_owner = o;}
	//void setAll(int x, int y, char i, int c){m_x = x; m_y = y; m_icon = i; m_color = c;}
	void draw()
	{
		setConsoleCursor(m_x,m_y);
		setConsoleColor(m_color);
		printf("%c",m_icon);
	}
	void update()
	{
		//if(m_next_x != 0 || m_next_y != 0)
		{
			addMotion(m_next_x, m_next_y);
			m_next_x = 0;
			m_next_y = 0;
		}
	}

};